#include "Card.h"

Card::Card(Suit card_suit,Rank  card_rank,int  card_id){
	suit = card_suit;
	rank = card_rank;
	id = card_id;
}

void Card::debugPrint(bool louder)
{
  if(rank == joker)
  {
    cout << "J ";
  }
  else switch(getSuit())
  {
    case clubs:
      cout << "C";
      break;
    case diamonds:
      cout << "D";
      break;
    case hearts:
      cout << "H";
      break;
    case spades:
      cout << "S";
      break;
  }
  switch(rank)
  {
    case ace:
      cout << "A ";
      break;
    case jack:
      cout << "J ";
      break;
    case queen:
      cout << "Q ";
      break;
    case king:
      cout << "K ";
      break;
    case joker:
      cout << "  ";
      break;
    default:
      cout << getRank();
      break;
  }
  if(louder)
    cout << "(id=" << id << ", owner=" << (long)owner << ", &="
         << (long)this << ")";
  return;
}

bool Card::getIsJoker(){
	return rank == joker;
}

Suit Card::getSuit(){
	return suit;
}

Rank Card::getRank(){
	return rank;
}

int Card::getID(){
	return id;
}

Player* Card::getOwner(){
	return owner;
}

void Card::setOwner(Player* card_owner){
	owner = card_owner;
}

int Card::compareCard(Card comparison_card){
	if(rank > comparison_card.rank){
		return 1;
	}

	if(rank < comparison_card.rank){
		return -1;
	}

	if(rank == comparison_card.rank){
		return 0;
	}
	return -2;
}
